﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Rabbit.Contracts.Interface;
using Rabbit.Domain.Entity;

namespace Rabbit.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ButcherController : ControllerBase
    {
        private readonly IButcherService _butcherService;
        private readonly ILogger<ButcherController> _logger;

        public ButcherController(IButcherService butcherService, ILogger<ButcherController> logger)
        {
            _butcherService = butcherService;
            _logger = logger;
        }

        /// <summary>
        /// 显示
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetButcherShow(int id)
        {
            var list=_butcherService.GetButcherShow(id);
            return Ok(list);
        }

        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetButcherFind(int id)
        {
            var list=_butcherService.GetButcherFind(id);
            return Ok(list);
        }

        /// <summary>
        /// 修改屠宰
        /// </summary>
        /// <param name="butcher"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetButcherXiu(Butcher butcher)
        {
            var list = _butcherService.GetButcherXiu(butcher);
            return Ok(list);
        }

        /// <summary>
        /// 添加屠宰
        /// </summary>
        /// <param name="butcher"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetButcherAdd(Butcher butcher)
        {
            var list = _butcherService.GetButcherAdd(butcher);
            return Ok(list);
        }


        /// <summary>
        /// 省
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public IActionResult GetProvince()
        {
           var list=_butcherService.GetProvince();
            return Ok(list);
        }

        /// <summary>
        /// 市
        /// </summary>
        /// <param name="provinceid"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public IActionResult GetCitie(int provinceid)
        {
            var list=_butcherService.GetCitie(provinceid);
            return Ok(list);
        }

        /// <summary>
        /// 区
        /// </summary>
        /// <param name="cityid"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public IActionResult GetArea(int cityid)
        {
            var list=_butcherService.GetArea(cityid);
            return Ok(list);
        }


        /// <summary>
        /// 屠宰显示
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetTcompanies()
        {
            var list=_butcherService.GetTcompanies();
            return Ok(list);
        }

        /// <summary>
        /// 屠宰反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetTcompanyFind(int id)
        {
            var list=_butcherService.GetTcompanyFind(id);
            return Ok(list);
        }

        /// <summary>
        /// 屠宰修改
        /// </summary>
        /// <param name="tcompany"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetTcompanyXiu(Tcompany tcompany)
        {
            var list=_butcherService.GetTcompanyXiu(tcompany);
            return Ok(list);
        }
    }
}
